/**
 * Proyecto: Cognitum
 * Global IT Services 2008
 * @author Mislas
 */

Cognitum.Cartera.PersonaFisica.Editor = Ext.extend(Karma.EBCard, {

	initComponent: function(){
		Ext.apply(this, {
			sections: [{
	        title: 'General',
	        items: [{
	                xtype: 'entity.link',
					entityName: 'Grupos',
	                fieldLabel: 'Grupo',
	                name: 'Grupo'
	            },{
	                xtype: 'entity.link',
					entityName: 'Giros',
	                fieldLabel: 'Giro',
	                name: 'Giro'
	            },{
	                fieldLabel: 'Nombre',
	                name: 'Nombre'
	            },{
	                fieldLabel: 'Apellido paterno',
	                name: 'ApellidoPaterno'
	            },{
	                fieldLabel: 'Apellido materno',
	                name: 'ApellidoMaterno'
	            },{
	                fieldLabel: 'Email',
	                name: 'Email',
					vtype: 'email'
	            },{
					xtype: 'enum.combo',
					enumName: 'Cognitum.Dominio.Cartera.EstadoCivilEnum',
	                fieldLabel: 'Estado civil',
	                name: 'EstadoCivil',
					anchor: '60%'
	            },{
					xtype: 'enum.combo',
					enumName: 'Cognitum.Dominio.Cartera.SexoEnum',
	                fieldLabel: 'Sexo',
	                name: 'Sexo',
					anchor: '60%'
	            },{
					xtype: 'datefield',
	                fieldLabel: 'Fecha nacimiento',
	                name: 'FechaNacimiento',
					anchor: '60%'
	            },{
	                fieldLabel: 'RFC',
	                name: 'Rfc',
					anchor: '60%'
	            },{
	                fieldLabel: 'CURP',
	                name: 'Curp',
					anchor: '70%'
	            },{
	                fieldLabel: 'NombreCompleto',
	                name: 'NombreCompleto',
					xtype: 'hidden'
	            }, {
	                xtype: 'enum.combo',
	                enumName: 'Cognitum.Dominio.Aplicacion.EstatusEnum',
	                fieldLabel: 'Estatus',
	                name: 'Estatus',
	                disabled: true
	            }
	        ]},{
		        title: 'Telefonos',
		        items: [{
					xtype: 'ag.list',
					entityName: 'Telefonos',
	                hideLabel: true,
	                name: 'Telefonos',
					anchor: '99% 99%',
					context: 'p.Contacto.Id=?'
	            }]
			},{
		        title: 'Direcciones',
		        items: [{
					xtype: 'ag.list',
					entityName: 'Direcciones',
	                hideLabel: true,
	                name: 'Direcciones',
					anchor: '99% 99%',
					context: 'p.Cliente.Id=?'
	            }]
			},{
				xtype: 'sec.editor',
				title: 'Info Permisos'
			},{
				xtype: 'aud.editor',
				title: 'Info registro'
			}]
		});
		Cognitum.Cartera.PersonaFisica.Editor.superclass.initComponent.apply(this, arguments);
	},
	
	onBeforeSave: function(value){
		value.NombreCompleto = value.Nombre + ' ' + value.ApellidoPaterno + ' ' + 
			value.ApellidoMaterno;
		return Cognitum.Cartera.PersonaMoral.Editor.superclass.onBeforeSave.apply(this, arguments);
	}
	
});

Ext.reg('pf.editor', Cognitum.Cartera.PersonaFisica.Editor);
